/*****************************************************
Copyright (C) 2020. All rights reserved.
File name     ：InsertionSort.c
Version       ：v1.0
Author        ：zhengqijun
Date          ：2020-04-06
Function List ：
Description   ：Insertion Sort
******************************************************/

#include "InsertionSort.h"

void InsertionSort(ElementType A[], int N) {
    int i;
    int j;

    ElementType Tmp;
    for (i = 1; i < N; ++i) {
        Tmp = A[i];
        for (j = i; j > 0 && A[j - 1] > Tmp; --j) {
            A[j] = A[j - 1];
        }

        A[j] = Tmp;
    }
}

// EOF

